{extend name="layouts/admin"}
{block name="title"}添加商品{/block}
{block name="head"}
{/block}
{block name="tab"}
<li>
	<a href="">
		设置中心
		<span class="arrow fa fa-sort-up"></span>
	</a>
</li>

{/block}
{block name="content"}
<form action="" method="post" id="setting-form" class="layui-form" enctype="multipart/form-data">
	<div class="layui-form-item">
		<label class="layui-form-label">APP_ID</label>
		<div class="layui-input-block">
			<input type="text" name="appid" required autocomplete="off" class="layui-input" value="{$setting.appid}">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">APP_SECRET</label>
		<div class="layui-input-block">
			<input type="text" name="appsecret" required autocomplete="off" class="layui-input" value="{$setting.appsecret}">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">商户ID</label>
		<div class="layui-input-block">
			<input type="text" name="mchid" required autocomplete="off" class="layui-input" value="{$setting.mchid}">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">商户KEY</label>
		<div class="layui-input-block">
			<input type="text" name="mchkey" required autocomplete="off" class="layui-input" value="{$setting.mchkey}">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">*cert.pem</label>
		<div class="layui-input-block">
			<input type="file" name="cert_pem" required class="layui-input">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">*key.pem</label>
		<div class="layui-input-block">
			<input type="file" name="key_pem" required class="layui-input">
		</div>
	</div>
	<div class="layui-form-item">
		<a href="javascript:void(0)" class="layui-btn" id="submit-setting-btn">提交设置</a>
	</div>
</form>
{/block}
{block name="foot"}
<script>
	$().ready(function () {
		$('#setting-form').ajaxForm();
	});
	$('#submit-setting-btn').on('click', function () {
		$('#setting-form').ajaxSubmit({
			beforeSubmit: function () {
				layer.load();
			},
			complete: function () {
				layer.closeAll('loading');
			},
			error: function () {
				layer.alert('网络服务器错误,请稍后重试', {icon: 2});
			},
			success: function (resp) {
				if (resp.status == 'success') {
					layer.alert(resp.msg, {
						icon: 6
					});
				} else {
					layer.alert(resp.msg, {icon: 5});
				}
			}
		});
	});
</script>
{/block}